home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1702 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.2 KB  |  85 lines

  1. Path: cea.fr!usenet
  2. From: Xavier Tarrago <tarrago@lcus15.saclay.cea.fr>
  3. Newsgroups: comp.lang.c++
  4. Subject: STL & HP C++
  5. Date: 12 Jan 1996 11:57:01 GMT
  6. Organization: CEA Commissariat a l'Energie Atomique, France.
  7. Message-ID: <4d5iad$1a7@news.cea.fr>
  8. NNTP-Posting-Host: lcus15.saclay.cea.fr
  9.  
  10.  Hello,
  11.   I cannot use STL whith HP C++. When I use STL (vector) I get this
  12.  
  13. // vector.C
  14. #include <iostream.h>
  15. #include "../stl/vector.h"
  16.  
  17. vector<double> v(10, 0.);
  18.  
  19. void fonc( vector<double> v)
  20. {
  21.         for( int i = 0; i< v.size(); i++){
  22.                 cout << v[i] << '\n';
  23.         }
  24.         return;
  25. }
  26.  
  27. int main(void){
  28.         fonc( v);
  29.         return 0;
  30. }
  31.  
  32. I get:
  33. make vector
  34.         CC -I../stl vector.C  -o vector
  35. CC: "../stl/function.h", line 130: error: template unary_function  argument mismatch, th
  36. e template formal: Arg required a type actual parameter (1782)
  37. CC: "../stl/function.h", line 146: error: template binary_function  argument mismatch, t
  38. he template formal: Arg1 required a type actual parameter (1782)
  39. CC: "../stl/function.h", line 146: error: template binary_function  argument mismatch, t
  40. he template formal: Arg2 required a type actual parameter (1782)
  41. CC: "../stl/function.h", line 164: error: template unary_function  argument mismatch, th
  42. e template formal: Arg required a type actual parameter (1782)
  43. CC: "../stl/function.h", line 164: error: template unary_function  argument mismatch, th
  44. e template formal: Result required a type actual parameter (1782)
  45. CC: "../stl/function.h", line 167: sorry, not implemented: use of  Operation::first_argu
  46. ment_type  with formal template type parameter (2097)
  47. CC: sorry, cannot recover from previous errors
  48. *** Error code 1
  49.  
  50. Stop.
  51.  
  52. I can get the same error whith :
  53. template < class T >
  54. class tpl {
  55.    T i;
  56.    T::ptr p;  // trouble here
  57. };
  58.  
  59. class dumm {
  60.    class ptr{
  61.       int i;
  62.    };
  63. };
  64.  
  65. int main( void)
  66. {
  67.    tpl<dumm> t;
  68.    return 0;
  69. }
  70.  
  71. make tst
  72.         CC -I../stl tst.C  -o tst
  73. CC: "tst.C", line 4: sorry, not implemented: use of  T::ptr  with formal template type p
  74. arameter (2097)
  75. CC: sorry, cannot recover from previous errors
  76. *** Error code 1
  77.  
  78. Stop.
  79.  
  80. Is ther a way to do that. Maybe a patch or maybe I have to upgrade my
  81. compiler. I am surprised that STL from HP don't work whith HP C++.
  82.  
  83.  Thank you in advance,
  84.    X.Tarrago
  85.